﻿using System;
using System.Collections.Generic;

namespace CMS.Dao {
	public class Article : IDao {
		public int Count(int categoryId) {
			return (int)SqlMapper.QueryForObject("Article.Count", categoryId);
		}

		public int MaxID() {
			return (int)SqlMapper.QueryForObject("Article.MaxID", null);
		}

		public IList<Model.Article> List(int categoryId, int skipResults, int maxResults) {
			return SqlMapper.QueryForList<Model.Article>("Article.List", categoryId, skipResults, maxResults);
		}

		public Model.Article Select(int articleId) {
			return SqlMapper.QueryForObject<Model.Article>("Article.Select", articleId);
		}

		public object Insert(Model.Article model) {
			return SqlMapper.Insert("Article.Insert", model);
		}

		public object Update(Model.Article model) {
			return SqlMapper.Update("Article.Update", model);
		}

		public object Delete(int articleId) {
			return SqlMapper.Delete("Article.Delete", articleId);
		}
	}
}
